﻿using SpeakTechnology.Presentation;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SpeakTechnology.LogicOfBussiness;
namespace SpeakTechnology
{
    public partial class ControlUser : Form
    {
         
        public ControlUser()
        {
            InitializeComponent();
        }

        private void Enter_Click(object sender, EventArgs e)
        {
            C_usuario usu = new C_usuario();
            if (usu.valir_name_pass(BoxUser.Text, BoxPass.Text))
            {
                MessageBox.Show(" What Have you  ingress the name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else 
            {
                if (C_usuario.usuario(BoxUser.Text, BoxPass.Text))
                {
                    MMenu mm = new MMenu();
                    mm.Show();
                    this.Visible = false;
                }
                else 
                {
                    MessageBox.Show("Not the valid username or password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
           
        }

        private void BoxPass_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsDigit(e.KeyChar))
            {
                e.Handled = false;
            }
            else if (Char.IsControl(e.KeyChar))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }

        private void BoxUser_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsLetter(e.KeyChar))
            {
                e.Handled = false;
            }
            else if (Char.IsControl(e.KeyChar))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            User u = new User();
            u.Show();
            u.Visible = true;
            this.Visible = false;
        }

      

       
    }
}
